package org.springblade.modules.admin.controller.suger;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.tool.api.R;
import org.springblade.modules.admin.service.suger.IEstateMalfunctionScreenService;
import org.springblade.modules.admin.vo.sugar.MalScreenVO;
import org.springblade.modules.admin.vo.sugar.TodayMalDataVO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Description 物业大屏-报障维修
 * @Author ysq
 * @Date 2022/12/22
 **/
@RestController
@RequestMapping("/estate/malfunction/screen")
@AllArgsConstructor
@Api(value = "物业大屏-报障维修", tags = "物业大屏-报障维修")
public class EstateMalfunctionScreenController {

	private final IEstateMalfunctionScreenService estateMalfunctionScreenService;

	@GetMapping("/today")
	@ApiOperation(value = "报障维修-今日维修")
	public R<TodayMalDataVO> todayData() {
		return R.data(estateMalfunctionScreenService.todayData());
	}

	@GetMapping("/top")
	@ApiOperation(value = "报障维修-维修排行榜top10")
	public R<List<MalScreenVO>> top() {
		return R.data(estateMalfunctionScreenService.top());
	}

	@GetMapping("/mal/detail")
	@ApiOperation(value = "报障维修-报障情况")
	public R<List<MalScreenVO>> malDetail(@ApiParam(value = "类型: 0-近7天, 1-近6个月(默认)") @RequestParam(required = false, defaultValue = "1") Integer mode) {
		return R.data(estateMalfunctionScreenService.malDetail(mode));
	}

}
